package com.health.mapp.impl;

import java.util.List;

import org.apache.log4j.Logger;

import com.health.db.model.PatientList;
import com.health.db.model.PatientListTemp;
import com.health.db.service.user.IPatientListService;
import com.health.mapp.bean.Header;
import com.health.mapp.bean.QueryPatientReq;
import com.health.mapp.bean.QueryPatientResp;
import com.health.mapp.utils.Response;

public class QueryPatientImpl implements ActionInterface{
	
	private static String TAG="QueryPatientImpl";
	private static Logger logger = Logger.getLogger(QueryPatientImpl.class);
	private IPatientListService patientListService ;
	@Override
	public Response execute(Header header, Object reqBean) throws Exception {
		// TODO Auto-generated method stub
		logger.info(TAG+"");
		QueryPatientReq req=(QueryPatientReq) reqBean;
		QueryPatientResp _resp=new QueryPatientResp();
		long userId=req.getUserId();
		long patId=req.getPatId();
		
		if(userId<=0)
		{
			_resp.setErrorCode(-1);     
			_resp.setErrorMsg("用户ID不能为空");
		}else {
			PatientList patientList=new PatientList();
			patientList.setUserid(userId);
			patientList.setPatientid(patId);
			
			List<PatientListTemp> patients=patientListService.selectByPatientListSelective(patientList);
			_resp.setErrorCode(0);
			_resp.setErrorMsg("Success");
			_resp.setPatList(patients);
		}
		
		return _resp;
	}
	public IPatientListService getPatientListService() {
		return patientListService;
	}
	public void setPatientListService(IPatientListService patientListService) {
		this.patientListService = patientListService;
	}
	 
    
}
